package com.fx.spring.context;

import com.fx.spring.jfx.AbstractSpringStartFX;
import javafx.stage.Stage;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.stereotype.Component;

/**
 * JavaFX 上下文
 */
@Component
//@Configuration
public class ApplicationContextFX {
    private AbstractSpringStartFX startClass;
    private Stage primaryStage;
    /** 开始时间(ms) */
    private long startTime;
    /** 启动耗时(ms) */
    private long startUpTime;

    public long getStartTime() {
        return startTime;
    }

    public void setStartTime(long startTime) {
        this.startTime = startTime;
    }

    public AbstractSpringStartFX getStartClass() {
        return startClass;
    }

    public void setStartClass(AbstractSpringStartFX startClass) {
        this.startClass = startClass;
    }

    public Stage getPrimaryStage() {
        return primaryStage;
    }

    public void setPrimaryStage(Stage primaryStage) {
        this.primaryStage = primaryStage;
    }

    /** 计算启动时间 */
    public void startUpTime(long endTime) {
        this.startUpTime = endTime - startTime;
    }

    /**
     * @return 获取启动耗时
     */
    public long getStartUpTime() {
        return this.startUpTime;
    }
}
